#! /bin/bash

# Usage
if [[ $# -ne 1 ]]; then
 echo "Usage: compile_js <directory>"
 exit
fi;

# Get the js file names
result=""
for file in `find $1 -name "*.js"`
do
  result=$result" "$file
done

# Run the closure compiler
echo "java -jar $HOME/closure/compiler.jar --js $result --js_output_file compiled.js"
java -jar $HOME/closure/compiler.jar --js $result --js_output_file $1-compiled.js
